package com.codi.bus.core.dao.impl;

import com.codi.base.dao.v2.GeneratedBaseDaoImpl;
import com.codi.bus.core.dao.PortfolioTradeAccoDao;
import com.codi.bus.core.domain.PortfolioTradeAcco;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class PortfolioTradeAccoDaoImpl extends GeneratedBaseDaoImpl<PortfolioTradeAcco> implements PortfolioTradeAccoDao {
    @Override
    public List<PortfolioTradeAcco> selectByPortfolioCode(PortfolioTradeAcco portfolioTradeAcco) {
        return this.findList("selectByPortfolioCode", portfolioTradeAcco);
    }

    @Override
    public List<PortfolioTradeAcco> selectByPortfolioTradeAccount(PortfolioTradeAcco portfolioTradeAcco) {
        return this.findList("selectByPortfolioTradeAccount", portfolioTradeAcco);
    }

    @Override
    public List<PortfolioTradeAcco> selectPortfolioTradeAccoByUserId(Long userId) {
        return getSqlSession().selectList("selectPortfolioTradeAccoByUserId", userId.intValue());
    }

    @Override
    public PortfolioTradeAcco selectByUserIdAndPortfolioCode(Long userId, String portfolioCode) {
        Map<String, Object> params = new HashMap<>();
        params.put("userId", userId);
        params.put("portfolioCode", portfolioCode);
        return getObject("selectByUserIdAndPortfolioCode", params);
    }
}
